package com.frank.stock4j.dataloader.loaders;

import com.frank.stock4j.dataloader.abstractloader.AbstractBasicDataLoader;
import com.frank.stock4j.tusharepro.mapper.StockBasicMapper;
import com.frank.stock4j.tusharepro.entity.StockBasicEntity;
import lombok.SneakyThrows;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StockBasicLoader extends AbstractBasicDataLoader<StockBasicEntity, StockBasicMapper> {

    public static List<StockBasicEntity> cacheList;


    @Override
    public String getApiName() {return "stock_basic";}


    @Override
    public List<StockBasicEntity> load() {
        cacheList = super.load();
        return cacheList;
    }

    @SneakyThrows
    public List<StockBasicEntity> getList() {
        if (cacheList == null) {
            load();
        }
        return cacheList;
    }
}
